package com.example.panpan.system.controller;

import com.example.common.utils.IMap;
import com.example.common.utils.ReturnMapUtils;
import com.example.panpan.orderManage.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
public class dataController {

    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "/dataController/toPage/dataReport")
    public String dataReport ( ModelMap modelMap){
        return "/module/report/dataReport";
    }

    @RequestMapping(value = "/dataController/ajax/countSumByAge")
    @ResponseBody
    public Map countSumByAge(HttpServletRequest request){
        IMap param = new IMap(request);
        List<IMap> result = orderService.countSumByAge(param.getString("age"));
        return ReturnMapUtils.businessResult("0000","",result);
    }
}
